<?php ob_start();?>
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include($root.'/standart/head.php');
include($root.'/standart/dateHeader.php');
include($root.'/standart/checkUser.php');
$db = connect();
if(isset($_GET["NAME"]) && isset($_GET["SHORT_NAME"])){
	$name = $_GET["NAME"];
	$sName = $_GET["SHORT_NAME"];
	$stmt ="INSERT INTO UNITS (UNIT_NAME, UNIT_SHORT) VALUES(?,?)";
	$statement = $db->prepare($stmt);
	$statement->bind_param('ss', $name, $sName);
	$statement->execute();
	$statement->close();
}else {
	$stmt ="SELECT ID, UNIT_NAME
			FROM UNITS";
	$res = $db->query($stmt) or die($stmt."<br/><br/>".mysql_error());
	echo "<option value=''>Seçiniz</option>";
	while($row = $res->fetch_assoc()){
		echo '<option value="'.$row['ID'].'">'.$row['UNIT_NAME'].'</option>';
	}
	$res->close();
}
disconnect($db);
?>
<?php ob_end_flush(); ?>